async function selectChange(){
    chrome.storage.sync.get("switchStaticType", function(data){
        if ( data.switchStaticType == 'on' ) {
            chrome.storage.sync.set({"switchStaticType": "off"});
            document.querySelector("span").innerText = '开启';
            document.querySelector("span").style.color = "blue";
        } else {
            chrome.storage.sync.set({"switchStaticType": "on"});
            document.querySelector("span").innerText = '关闭';
            document.querySelector("span").style.color = "red";
        }
    });
}

window.onload = async function(){
    chrome.storage.sync.get("switchStaticType", function(data){
        if ( data.switchStaticType == undefined ) {
            chrome.storage.sync.set({"switchStaticType": "off"});
            document.querySelector("span").innerText = '开启';
            document.querySelector("span").style.color = "blue";
        } else if ( data.switchStaticType == 'on' ) {
            document.querySelector("span").innerText = '关闭';
            document.querySelector("span").style.color = "red";
        } else {
            document.querySelector("span").innerText = '开启';
            document.querySelector("span").style.color = "blue";
        }
        document.querySelector("span").onclick = function(){
            selectChange();
        }
    });
}